﻿using Quartz;

namespace UsingDataDemo.Jobs;

public class ShowCounterJob : IJob
{
    public static readonly JobKey Key = new JobKey(nameof(ShowCounterJob), "data-passing");
    // 如果定认了一个属性，JobDataMap 刚好有同名的键，会自动赋值    
    public async Task Execute(IJobExecutionContext context)
    {

        //var currentCounter=context.MergedJobDataMap.GetInt(CounterJob.CounterKey);
        Console.WriteLine($"From ShowCounter, Current counter is {CounterJob.CurrentCounter}");
        //Console.WriteLine($"From ShowCounter");

        await Task.Delay(1000);
    }
}
